package pers.wensheng.patterns.behavioral_pattern.iterator_pattern.jdk_impl;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Iterator;
import java.util.NoSuchElementException;

/**
 * 学生类
 */
@Data
@AllArgsConstructor
public class Student implements Iterable{
    private String name;
    private String number;

    /**
     * Returns an iterator over elements of type {@code T}.
     *
     * @return an Iterator.
     */
    @Override
    public Iterator iterator() {
        return new Itr();
    }

    private class Itr implements Iterator{


        /**
         * Returns {@code true} if the iteration has more elements.
         * (In other words, returns {@code true} if {@link #next} would
         * return an element rather than throwing an exception.)
         *
         * @return {@code true} if the iteration has more elements
         */
        @Override
        public boolean hasNext() {
            return false;
        }

        /**
         * Returns the next element in the iteration.
         *
         * @return the next element in the iteration
         * @throws NoSuchElementException if the iteration has no more elements
         */
        @Override
        public Object next() {
            return null;
        }
    }


}
